﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Cloak.NUnit;
using Cloak.Reflection;
using NUnit.Framework;
using Ruleweaver.Rules;

namespace Ruleweaver.Conditions
{
	public class CreateCondition : Behavior
	{
		private CheckRule _isPositiveRule;
		private ConditionKey _key;
		private Condition _condition;

		protected override void Given()
		{
			_isPositiveRule = Rule.Check(Reflect.Func<ICheckable<int>, Check<int>>(Checkable.IsPositive));

			_key = new ConditionKey(typeof(int));
		}

		protected override void When()
		{
			_condition = new Condition(_isPositiveRule, _key);
		}

		[Then]
		public void RuleIsOriginal()
		{
			Assert.AreEqual(_isPositiveRule, _condition.Rule);
		}

		[Then]
		public void KeyIsOriginal()
		{
			Assert.AreEqual(_key, _condition.Key);
		}
	}
}